﻿using System;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace duia.Canteenpay.Domain
{
    /// <summary>
    /// 仓储基类
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public interface IBaseRepository<TEntity> where TEntity : BaseEntityId
    {
        /// <summary>
        /// 工作单元
        /// </summary>
        IAppUnitOfWork AppUnitOfWork { get; }

        Task<TEntity> AddAsync(TEntity entity);

        void RemoveAsync(TEntity entity);

        void RemoveAsync(Guid[] parameKeyId);

        void UpdateAsync(TEntity entity);

        Task<TEntity> Find(Expression<Func<TEntity, bool>> wherExpression);

        Task<IQueryable<TEntity>> FindByCondition(Expression<Func<TEntity, bool>> wherExpression);

    }
}
